using System;
using Microsoft.Extensions.DependencyInjection;
using t01.Services;
using t01.ViewModels;

namespace t01;

// TODO: Important

public class ServiceLocator
{
    private readonly IServiceProvider _serviceProvider;

    public MainWindowViewModel MainWindowViewModel
    {
        get
        {
            return _serviceProvider.GetService<MainWindowViewModel>();
        }
    }


    public ServiceLocator()
    {
        var serviceCollection = new ServiceCollection();

        serviceCollection.AddSingleton<MainWindowViewModel>();
        serviceCollection.AddSingleton<IPoetryStorage, PoetryStorage>();

        _serviceProvider = serviceCollection.BuildServiceProvider();
    }


}